<?php

function boolToStr($val) {
    if ($val) {
        return 'tak';
    } else {
        return 'nie';
    }
}

function renderOfferType($row) {
    $type = $row['type'];
    if ($type == Application_Model_DAO_Offer::TYPE_FREE) {
        return 'Darmowe';
    } else {
        return 'Płatne - ' . Application_Model_DAO_Payment::getTranslatetPaymentStatus($row['status']);
    }
}

echo $this->table($this->list, array(
    'Tytuł' => 'title',
    'Adres' => 'address',
    'Miejscowość' => 'city',
//    'Dopuszczone' => array('eval' => 'boolToStr((bool)"${item.active}"). " / " .boolToStr((bool)"${item.admin_active}")'),
    'Aktywne' => array('eval' => 'boolToStr((bool)"${item.admin_active}")'),
    'Typ (płatność)' => array('eval' => 'renderOfferType($row)'),
    'Operacje' => array(
        $this->smartButton('Wyświetl', $this->url(array('controller' => 'catalog', 'action' => 'show', 'id' => '${item.offer_code}'), 'default', true), array('size' => 'mini', 'noAjax' => true))
    )
        ), array(
    'rowClass' => 'active-${item.admin_active}'
        )
);